﻿
@{
    ViewBag.Title = "访问记录";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}
@section styles
{
    <environment names="Development">
        <link href="~/css/plugins/jqgrid/ui.jqgrid.css" rel="stylesheet" />
    </environment>
    <environment names="Staging,Production">
        <link rel="stylesheet" href="~/css/grid.min.css" asp-append-version="true" />
    </environment>
}

<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>访问记录</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <div class="form-group">
                <div class="input-group">
                    <input id="txtSearchKey" type="text" class="input form-control" placeholder="搜索关键字" />
                    <span class="input-group-btn">
                        <button id="btnSearch" class="btn btn btn-primary" type="button"> <i class="fa fa-search"></i> 搜索</button>
                    </span>
                </div>
            </div>

            <div class="jqGrid_wrapper">
                <table id="table_list"></table>
                <div id="pager_list"></div>
            </div>
        </div>
    </div>
</div>

@section scripts
{
    <environment names="Development">
        <script src="~/js/plugins/jqgrid/jquery.jqGrid.js"></script>
        <script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js"></script>
        <script src="~/js/jqgrid-list.js"></script>
        <script src="~/js/base.js"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/js/grid.min.js" asp-append-version="true"></script>
    </environment>
    <script>
        function searchData() { //搜索
            var json = {
                keywords: $("#txtSearchKey").val()
            };
            XPage.Search(json);
        }

        $(document).ready(function() {
            var config = {
                title: '访问记录',
                url: '@Url.Action("VisitsList")',
                colNames: ['主键', '登录名', 'URL', 'Ip', '时间'],
                colModel: [
                    { name: 'id', index: 'id', width: 60, key: true, hidden: true },
                    { name: 'loginName', index: 'loginName', width: 60 },
                    { name: 'url', index: 'url', width: 60 },
                    { name: 'ip', index: 'ip', width: 60 },
                    {
                        name: 'visitDate',
                        index: 'visitDate',
                        width: 60,
                        formatter: function(cellValue, options, rowObject) {
                            return cellValue;
                        }
                    }
                ]
            };
            JucheapGrid.Load(config);
            $("#btnSearch").bind("click", searchData);
        });
    </script>
}
